<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="utf-8">
    <title>修改分类</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="format-detection" content="telephone=no">
    <link rel="stylesheet" href="/layui/css/layui.css" media="all" />
    <link rel="stylesheet" href="/plugns/colorpicker/colpick.css" media="all" />
    <link rel="stylesheet" type="text/css" href="//at.alicdn.com/t/font_1041315_0zq2yro0cfn.css">
    <style type="text/css">
        .layui-form-item .layui-inline{ width:33.333%; float:left; margin-right:0; }
        @media(max-width:1240px){
            .layui-form-item .layui-inline{ width:100%; float:none; }
        }
        .layui-form-item .role-box {
            position: relative;
        }
        .layui-form-item .role-box .jq-role-inline {
            height: 100%;
            overflow: auto;
        }
        .color-box {
            float:left;
            width:30px;
            height:30px;
            margin:5px;
            border: 1px solid white;
        }
    </style>
</head>
<body class="childrenBody">
<form class="layui-form" style="width:80%;">
    <div class="layui-form-item">
        <fieldset class="layui-elem-field layui-field-title" style="margin-top: 10px;">
            <legend style="font-size:16px;"></legend>
        </fieldset>
    </div>
    <input class="layui-hide" name="id" th:value="${tbSort.id}"/>
    <div class="layui-form-item">
        <label class="layui-form-label">分类名称</label>
        <div class="layui-input-block">
            <input type="text" class="layui-input" name="name" lay-verify="required" th:value="${tbSort.name}" placeholder="请输入菜单名称">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">排序</label>
        <div class="layui-input-block">
            <input type="text" class="layui-input" name="sort" th:value="${tbSort.sort}" lay-verify="required|number"  placeholder="排序">
        </div>
    </div>
    <div class="layui-form-item">
        <div class="layui-input-block">
            <button class="layui-btn layui-btn-normal" lay-submit="" lay-filter="editSort"><i class="iconfont icon-xiugai1"></i>修改</button>
            <button  class="layui-btn layui-btn-primary"><i class="iconfont icon-zhongzhi"></i>重置</button>
        </div>
    </div>
</form>
<script src="https://code.jquery.com/jquery-2.2.4.min.js"
        integrity="sha256-BbhdlvQf/xTY9gja0Dq3HiwQF8LaCRTXxZKRutelT44="
        crossorigin="anonymous"></script>
<script type="text/javascript" src="/layui/layui.js"></script>
<script type="text/javascript" src="/plugns/colorpicker/colpick.js"></script>
<script>
    var iconShow,$,color;
    layui.config({
        base: '/js/common/' //假设这是你存放拓展模块的根目录
    }).use(['form','jquery','layer','common','laytpl' ],function(){
        var form = layui.form,
                layer = layui.layer;
        common = layui.common;
        $    = layui.jquery;
        form.on("submit(editSort)",function(data){
            var editLoading = top.layer.msg('数据提交中，请稍候',{icon: 16,time:false,shade:0.8});
            $.post("edit",data.field,function (res) {
                if(res.success){
                    top.layer.close(editLoading);
                    common.cmsLaySucMsg("修改成功！");
                    var index = parent.layer.getFrameIndex(window.name); //先得到当前iframe层的索引
                    parent.layer.close(index); //再执行关闭                        //刷新父页面
                    parent.location.reload();
                }else{
                    top.layer.close(editLoading);
                    common.cmsLayErrorMsg(res.message);
                }
            });
            return false;
        });

    });
</script>
</body>
</html>